<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <footer th:fragment="table">
        <div class="tpl-content-wrapper">
            <div class="row-content am-cf">
                <div class="row">
                    <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                        <div class="widget am-cf">
                            <div class="widget-head am-cf">
                                <div class="widget-title  am-cf">系统日志</div>
                            </div>
                            <div class="widget-body  am-fr">

                                <div class="am-u-sm-12 am-u-md-6 am-u-lg-4">
                                    <div class="am-form-group">
                                        <div class="am-btn-toolbar">

                                        </div>
                                    </div>
                                </div>
                                <div class="am-u-sm-12 am-u-md-6 am-u-lg-2">
                                    <div class="am-input-group am-input-group-sm tpl-form-border-form cl-p">
                                        <input type="date" class="am-form-field" th:value="${#dates.format(beginTime,'yyyy-MM-dd')}" id="beginTime">
                                    </div>
                                </div>
                                <div class="am-u-sm-12 am-u-md-6 am-u-lg-2">
                                    <div class="am-input-group am-input-group-sm tpl-form-border-form cl-p">
                                        <input type="date" class="am-form-field " th:value="${#dates.format(endTime,'yyyy-MM-dd')}" id="endTime">
                                    </div>
                                </div>
                                <div class="am-u-sm-12 am-u-md-6 am-u-lg-2">
                                    <div class="am-input-group am-input-group-sm tpl-form-border-form cl-p">
                                        <input type="text" class="am-form-field " id="keyword" th:value="${keyword}">
                                        <span class="am-input-group-btn">
                                         <button class="am-btn  am-btn-default am-btn-success tpl-table-list-field am-icon-search"
                                                 type="button" th:onclick="|page(1)|"></button>
                                    </span>
                                    </div>
                                </div>

                                <div class="am-u-sm-12">
                                    <div style="overflow-x:scroll">
                                        <table class="am-table am-table-compact am-table-striped tpl-table-black "
                                               id="example-r">
                                            <thead>
                                            <tr>
                                                <th>
                                                    <button onclick="reSelect()"
                                                            class="am-btn  am-btn-default am-btn-success tpl-table-list-field"
                                                            type="button">反选
                                                    </button>
                                                </th>
                                                <th>编号</th>
                                                <th>记录ID</th>
                                                <th>管理员ID</th>
                                                <th>管理员名称</th>
                                                <th>记录类型</th>
                                                <th>记录时间</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <tr class="gradeX" th:each="systemRecord,s : ${systemRecordList.list}">
                                                <td><input type="checkbox" name="persons"></td>
                                                <td th:text="${s.index}"></td>
                                                <td th:text="${systemRecord.recordId}"></td>
                                                <td th:text="${systemRecord.userId}"></td>
                                                <td th:text="${systemRecord.userName}"></td>
                                                <td th:text="${systemRecord.operationName}"></td>
                                                <td th:text="${#dates.format(systemRecord.operationTime,'yyyy-MM-dd HH:mm:ss')}"></td>
                                            </tr>
                                            </tbody>
                                        </table>
                                    </div>
                                    <div class="am-u-lg-12 am-cf">

                                        <select data-am-selected="{btnSize: 'sm'}" id="pagesize" class="selectOption">
                                            <option value="">分页大小</option>
                                            <option value="5" th:selected="${pageSize==5}">5</option>
                                            <option value="10" th:selected="${pageSize==10}">10</option>
                                            <option value="10" th:selected="${pageSize==15}">15</option>
                                            <option value="10" th:selected="${pageSize==20}">20</option>
                                        </select>
                                        <div class="am-u-lg-3">
                                            跳转至:<input type="number" id="num" class="selectOption"  class="selectOption">/ 页
                                            <span>
                                            <button class="am-btn  am-btn-default am-btn-success tpl-table-list-field am-icon-search" type="button" th:onclick="findpage()"></button>
                                        </span>
                                        </div>

                                        <div class="am-fr">
                                            <ul class="am-pagination tpl-pagination">
                                                <li ><a href="javascript:" th:onclick="|page(${systemRecordList.navigateFirstPage})|">首页</a></li>
                                                <li  th:if="systemRecordList.hasPreviousPage"><a href="javascript:" th:onclick="|page(${systemRecordList.prePage})|">«</a></li>


                                                <li th:each="pageNum:${#numbers.sequence(1,systemRecordList.pages)}">
                                                    <a th:text="${pageNum}" th:onclick="|page(${pageNum})|"></a>
                                                </li>


                                                <li th:if="systemRecordList.hasNextPage"><a href="javascript:" th:onclick="|page(${systemRecordList.nextPage})|">»</a></li>
                                                <li><a href="javascript:" th:onclick="|page(${systemRecordList.navigateLastPage})|">尾页</a></li>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </footer>
    <script>
        function page(i) {
            let data = {
                    "beginTime":$("#beginTime").val(),
                    "endTime":$("#endTime").val(),
                    "keyword":$("#keyword").val(),
                    "pageNum":i,
                    "pageSize":$("#pagesize").val(),
            };
            $.ajax({
                url: "record/selectSystem",
                type: 'post',
                dataType: 'html',
                contentType:"application/json;charset=utf-8",
                data:JSON.stringify(data),
                success:function(data){
                    $("#content").html(data);
                },
                error:function(e){
                    console.log("获取数据失败")
                }
            })
        }


        function findpage() {
            var pagesnum=$('#num').val();
            page(pagesnum);
        }


    </script>
</head>
</html>
